import { request } from "@/utils/service"
import { getToken } from "@/utils/cache/cookies"
import axios from "axios"
const baseURL = import.meta.env.VITE_BASE_API
// 话费充值
export function rechargeAdd(data: any) {
  return request({
    url: "recharge/add",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
// 批量接口
export function testadd(data: any) {
  return request({
    url: "recharge/testadd",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
// 查询接口
export function rechargeQuery(data: any) {
  return request({
    url: "recharge/query",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
// 查询余额接口
export function moneyQuery(params: any) {
  return request({
    url: "money/query",
    method: "get",
    params
  })
}
// 查询充值面额
export function callQuery(params: any) {
  return request({
    url: "/call/queryFee",
    method: "get",
    params
  })
}

/**下载 */
export function downLoadOrderTable(data: any) {
  return axios({
    url: `${baseURL}/money/downMoney`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    responseType: "blob",
    data
  })
}

//  话费配置接口 查
export function configurationApi(params: any) {
  return request({
    url: "/call/query",
    method: "get",
    params
  })
}
//  获取上级
export function configurationSuperApi(params: any) {
  return request({
    url: "/call/querySuper",
    method: "get",
    params
  })
}
// 修改配置
export function updateConfigurationSuperApi(data: any) {
  return request({
    url: "/call/update",
    method: "post",
    data
  })
}
// 充值记录下载
export function rechargeRecord(data: any) {
  return axios({
    url: `${baseURL}/recharge/downRecharge`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    responseType: "blob",
    data
  })
}
// 交易明细下载
export function transactionDetail(data: any) {
  return axios({
    url: `${baseURL}/money/downMoney`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    responseType: "blob",
    data
  })
}

//记录查询
export function recListApi(params: any) {
  return request({
    url: "/recharge/querydetails",
    method: "get",
    params
  })
}
